var SESSION_KEY = 'user_session_diygw_com';


var Session = {
  getUser: function () {
    return wx.getStorageSync(SESSION_KEY) || null;
  },

  setUser: function (session) {
    wx.setStorageSync(SESSION_KEY, session);
  },

  clearUser: function () {
    wx.removeStorageSync(SESSION_KEY);
  },

  getToken: function (){
    var userInfo = this.getUser();
    return userInfo ? userInfo.token : null
  },

  getOpenId: function (){
    var userInfo = this.getUser();
    return userInfo ? userInfo.openId : null
  }
}

export default Session